package com.syq.dao;

import com.syq.pojo.SysUserOnline;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

/**
 * @author Sun Yueqi
 * @version 1.00
 * @time 2022/5/26 20:27
 */
public interface SysUserOnlineMapper {
    @Select("SELECT  sessionId FROM sys_user_online WHERE login_name= #{username} ")
    String findOnlineDataByUsername(String username);

    @Insert("INSERT INTO sys_user_online VALUES(#{sessionId},#{loginName},#{ipaddr},#{loginLocation},#{browser},#{os},#{status},#{startTimestamp},#{lastAccessTime},#{expireTime})")
    void addOnlineData(SysUserOnline online);

    @Delete("DELETE FROM sys_user_online WHERE login_name= #{username}")
    void deleteByUsername(String username);
}
